/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EC;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author TrangNHIT
 */
@Entity
@Table(name = "tbCustomers")
@NamedQueries({
    @NamedQuery(name = "Customers.findAll", query = "SELECT c FROM Customers c"),
    @NamedQuery(name = "Customers.findByCustID", query = "SELECT c FROM Customers c WHERE c.custID = :custID"),
    @NamedQuery(name = "Customers.findByCustFirstName", query = "SELECT c FROM Customers c WHERE c.custFirstName = :custFirstName"),
    @NamedQuery(name = "Customers.findByCustMiddleName", query = "SELECT c FROM Customers c WHERE c.custMiddleName = :custMiddleName"),
    @NamedQuery(name = "Customers.findByCustLastName", query = "SELECT c FROM Customers c WHERE c.custLastName = :custLastName"),
    @NamedQuery(name = "Customers.findByCustAddress", query = "SELECT c FROM Customers c WHERE c.custAddress = :custAddress"),
    @NamedQuery(name = "Customers.findByCustHomePhone", query = "SELECT c FROM Customers c WHERE c.custHomePhone = :custHomePhone"),
    @NamedQuery(name = "Customers.findByCustMobile", query = "SELECT c FROM Customers c WHERE c.custMobile = :custMobile"),
    @NamedQuery(name = "Customers.findByCustCreditCardNumber", query = "SELECT c FROM Customers c WHERE c.custCreditCardNumber = :custCreditCardNumber"),
    @NamedQuery(name = "Customers.findByCustCreditCardExpiry", query = "SELECT c FROM Customers c WHERE c.custCreditCardExpiry = :custCreditCardExpiry"),
    @NamedQuery(name = "Customers.findByAccountID", query = "SELECT c FROM Customers c WHERE c.accountID = :accountID")})
public class Customers implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cust_ID")
    private Integer custID;
    @Basic(optional = false)
    @Column(name = "Cust_FirstName")
    private String custFirstName;
    @Column(name = "Cust_MiddleName")
    private String custMiddleName;
    @Basic(optional = false)
    @Column(name = "Cust_LastName")
    private String custLastName;
    @Basic(optional = false)
    @Column(name = "Cust_Address")
    private String custAddress;
    @Basic(optional = false)
    @Column(name = "Cust_HomePhone")
    private String custHomePhone;
    @Basic(optional = false)
    @Column(name = "Cust_Mobile")
    private String custMobile;
    @Basic(optional = false)
    @Column(name = "Cust_CreditCardNumber")
    private String custCreditCardNumber;
    @Basic(optional = false)
    @Column(name = "Cust_CreditCardExpiry")
    @Temporal(TemporalType.TIMESTAMP)
    private Date custCreditCardExpiry;
    @Basic(optional = false)
    @Column(name = "Account_ID")
    private int accountID;
    @JoinColumn(name = "State_ID", referencedColumnName = "State_ID")
    @ManyToOne(optional = false)
    private States states;
    @JoinColumn(name = "Country_ID", referencedColumnName = "Country_ID")
    @ManyToOne(optional = false)
    private Countries countries;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "customers")
    private Accounts accounts;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "customers")
    private List<Orders> ordersList;

    public Customers() {
    }

    public Customers(Integer custID) {
        this.custID = custID;
    }

    public Customers(Integer custID, String custFirstName, String custLastName, String custAddress, String custHomePhone, String custMobile, String custCreditCardNumber, Date custCreditCardExpiry, int accountID) {
        this.custID = custID;
        this.custFirstName = custFirstName;
        this.custLastName = custLastName;
        this.custAddress = custAddress;
        this.custHomePhone = custHomePhone;
        this.custMobile = custMobile;
        this.custCreditCardNumber = custCreditCardNumber;
        this.custCreditCardExpiry = custCreditCardExpiry;
        this.accountID = accountID;
    }

    public Integer getCustID() {
        return custID;
    }

    public void setCustID(Integer custID) {
        this.custID = custID;
    }

    public String getCustFirstName() {
        return custFirstName;
    }

    public void setCustFirstName(String custFirstName) {
        this.custFirstName = custFirstName;
    }

    public String getCustMiddleName() {
        return custMiddleName;
    }

    public void setCustMiddleName(String custMiddleName) {
        this.custMiddleName = custMiddleName;
    }

    public String getCustLastName() {
        return custLastName;
    }

    public void setCustLastName(String custLastName) {
        this.custLastName = custLastName;
    }

    public String getCustAddress() {
        return custAddress;
    }

    public void setCustAddress(String custAddress) {
        this.custAddress = custAddress;
    }

    public String getCustHomePhone() {
        return custHomePhone;
    }

    public void setCustHomePhone(String custHomePhone) {
        this.custHomePhone = custHomePhone;
    }

    public String getCustMobile() {
        return custMobile;
    }

    public void setCustMobile(String custMobile) {
        this.custMobile = custMobile;
    }

    public String getCustCreditCardNumber() {
        return custCreditCardNumber;
    }

    public void setCustCreditCardNumber(String custCreditCardNumber) {
        this.custCreditCardNumber = custCreditCardNumber;
    }

    public Date getCustCreditCardExpiry() {
        return custCreditCardExpiry;
    }

    public void setCustCreditCardExpiry(Date custCreditCardExpiry) {
        this.custCreditCardExpiry = custCreditCardExpiry;
    }

    public int getAccountID() {
        return accountID;
    }

    public void setAccountID(int accountID) {
        this.accountID = accountID;
    }

    public States getStates() {
        return states;
    }

    public void setStates(States states) {
        this.states = states;
    }

    public Countries getCountries() {
        return countries;
    }

    public void setCountries(Countries countries) {
        this.countries = countries;
    }

    public Accounts getAccounts() {
        return accounts;
    }

    public void setAccounts(Accounts accounts) {
        this.accounts = accounts;
    }

    public List<Orders> getOrdersList() {
        return ordersList;
    }

    public void setOrdersList(List<Orders> ordersList) {
        this.ordersList = ordersList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (custID != null ? custID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customers)) {
            return false;
        }
        Customers other = (Customers) object;
        if ((this.custID == null && other.custID != null) || (this.custID != null && !this.custID.equals(other.custID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EC.Customers[custID=" + custID + "]";
    }

}
